feat(kms): add KMS region override configuration#2478
Open
crypt0fairy wants to merge 1 commit intomasterfrom
Open
feat(kms): add KMS region override configuration#2478crypt0fairy wants to merge 1 commit intomasterfrom
crypt0fairy wants to merge 1 commit intomasterfrom
Conversation
Add CONTROLLER_DISPERSER_KMS_REGION env var and --controller-disperser-kms-region flag to allow KMS keys to be stored in a different AWS region than other resources. When KMSRegion is specified, it overrides the default Region for KMS operations. When empty, falls back to using Region (existing behavior). Changes: - Add KMSRegion field to DispersalRequestSignerConfig - Add DisperserKMSRegionFlag to controller flags - Wire new flag in controller config - Add tests for override and default behavior
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2478 +/- ##
=======================================
Coverage 39.44% 39.45%
=======================================
Files 552 552
Lines 51035 51038 +3
=======================================
+ Hits 20133 20135 +2
- Misses 28355 28358 +3
+ Partials 2547 2545 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
pschork
approved these changes
Jan 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add KMS Region Override Configuration
Summary
Adds support for a dedicated KMS region configuration (
AWS_KMS_REGION) that can override the controller's default AWS region for KMS operations. This allows users to specify a different AWS region for KMS keys while using another region for general AWS services.Motivation
Users may need to store their KMS keys in a specific AWS region that differs from the region where their other AWS resources (DynamoDB, S3, etc.) are located.
Previously, KMS operations used the same region as other AWS services (
AWS_REGION). This change adds an optional override to specify a separate region specifically for KMS.Changes
Configuration
Added:
CONTROLLER_DISPERSER_KMS_REGIONenvironment variable--controller-disperser-kms-regionCLI flagKMSRegionfield inDispersalRequestSignerConfigstructRegion Resolution Logic:
Files Modified
api/clients/v2/dispersal_request_signer.goKMSRegionoptional field toDispersalRequestSignerConfigNewKMSDispersalRequestSignerto checkKMSRegionfirst, fallback toRegiondisperser/cmd/controller/flags/flags.goDisperserKMSRegionFlagfor KMS region overridedisperser/cmd/controller/config.goKMSRegionflag toDispersalRequestSignerConfigapi/clients/v2/dispersal_request_signer_test.goTestKMSRegionOverride- Verifies KMSRegion overrides RegionTestKMSRegionDefault- Verifies default behavior when KMSRegion is not setUsage Examples
Example 1: Using Different Regions for KMS and Other Services
Example 2: Using Same Region (Default Behavior)
Testing
Unit Tests
✅ All tests pass
TestKMSRegionOverride- Verifies KMSRegion overrides RegionTestKMSRegionDefault- Verifies default behavior when KMSRegion is not setBackward Compatibility
✅ Fully backward compatible
AWS_REGIONwhen override is not specifiedConfiguration Reference
AWS_REGIONCONTROLLER_DISPERSER_KMS_REGION--controller-disperser-kms-regionAWS_REGION)CONTROLLER_DISPERSER_KMS_KEY_ID--controller-disperser-kms-key-idImplementation Details
The implementation is straightforward: